package com.gadgets.busi.bm01.task.hook;

import com.gadgets.busi.bm01.common.event.GadgetsBm01TaskFileEvent;
import com.gadgets.busi.bm01.dto.TxtCopyTaskPathDTO;
import org.springframework.stereotype.Component;

/**
 * The type Task start hook.
 *
 * @author UncleXiu
 * @version V1.0.0
 * @data 2020 -09-21
 */
@Component(value = "fileGeneratorHook")
public class FileGeneratorHook extends AbstractBm01TaskHook<GadgetsBm01TaskFileEvent> {

    /**
     * 任务执行钩子
     *
     * @param event 事件信息
     */
    @Override
    public void excuteHook(GadgetsBm01TaskFileEvent event) {
        logger.info("{}钩子开始调度",this.getClass().getName());
        if(null==event){
            logger.error("事件信息为空，无法执行任务钩子，执行被终止...");
        }else {
            TxtCopyTaskPathDTO pathDTO = new TxtCopyTaskPathDTO();
            pathDTO.setTaskNo(event.getTaskNo());
            pathDTO.setFilePath(event.getTaskFilePath());
            int i = copyTxtTaskRepository.updateTaskFilePath(pathDTO);
        }
    }

}
